<%--
  Created by IntelliJ IDEA.
  User: RuoLi
  Date: 2023/3/6
  Time: 10:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>管理通知</title>
    <!-- import CSS -->
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/index.css">
    <!-- import Vue before Element -->
    <script src="<%=request.getContextPath()%>/js/vue.js"></script>
    <!-- import JavaScript -->
    <script src="<%=request.getContextPath()%>/js/element-ui.js"></script>
    <!-- axios -->
    <script src="<%=request.getContextPath()%>/js/axios.js"></script>
    <%--icon--%>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/fonts/element-icons.ttf">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/fonts/element-icons.woff">
</head>
<body>
<div id="app">
    <el-page-header @back="goBack" content="管理通知"></el-page-header>
    <el-divider></el-divider>
    <el-row :span="23" style="margin-top: 10px">
        <el-table
                :data="messageData"
                border
                height="615"
                style="width: 100%">
            <el-table-column
                    prop="tipId"
                    label="编号"
            width="150px">
            </el-table-column>
            <el-table-column
                    prop="tipTitle"
                    label="标题"
                    width="200px">
            </el-table-column>
            <el-table-column
                    prop="tipContext"
                    label="内容"
                    width="800px">
            </el-table-column>
            <el-table-column
                    prop="tipStatus"
                    label="状态"
                    width="100px">
            </el-table-column>
            <el-table-column
                    label="操作">
                <template slot-scope="scope">
                    <el-button
                            type="danger"
                            @click="AccountSuspension(scope.$index, scope.row)">删除
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
    </el-row>
</div>
</body>
    <script>
        new Vue({
            el:"#app",
            data(){
                return{
                    messageData:[],
                }
            },
            methods:{
                goBack() {
                    window.location.href = "/online_website/admin/index_admin.jsp";
                },
                getMessageData(){
                    // 获取数据
                    axios.get('/online_website/common/log/GetMessage').then((res) => {
                        this.messageData = res.data;
                    });
                },
                //删除消息
                AccountSuspension(index,row){
                    let tipId=row.tipId;
                    //发送数据
                    axios({
                        url: "/online_website/common/log/DeleteMessage",
                        method: "get",
                        contentType: "application/json",
                        params: {
                            tipId: tipId,
                        }
                    }).then((res) => {
                        if (res.data===1){
                            this.$message({
                                message: '删除成功',
                                type: 'success'
                            });
                        }else {
                            this.$message.error('删除失败');
                        }
                    })
                },
            },
            created(){
                this.getMessageData();
            },
        })
    </script>
</html>
